package com.llz.leaveApply.demo;

public class Demo2 {
//
    public void doCalculate(int x, int y, Calculate c) {
        int z = c.xxx(x, y);
        System.out.println(z);
    }

    public static void main(String[] args) {
        Demo2 d = new Demo2();

        d.doCalculate(8, 5, new Calculate() {
            @Override
            public int xxx(int a, int b) {
                return a * b;
            }
        });
        d.doCalculate(1, 7, (a, b) -> a + b);
        d.doCalculate(18, 2, (a, b) -> a - b);
    }
}

interface Calculate {
    int xxx(int a, int b);

}